package com.zjuee.base.dto.common.plan;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.zjuee.base.base.Converter;
import com.zjuee.base.bean.Pages;
import com.zjuee.base.model.common.plan.PlanRegime;
import lombok.*;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class PlanRegimeDto extends PlanRegime implements Converter<PlanRegime, PlanRegimeDto> {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Pages page;

    @Override
    public void convertToDo(PlanRegime planRegime) {
        BeanUtils.copyProperties(this, planRegime);
    }

    @Override
    public PlanRegimeDto convert(PlanRegime planRegime) {
        BeanUtils.copyProperties(planRegime, this);
        return this;
    }
}